<template>
	<view class="info-imgs">
		<image v-for="(img, index) of picSmallUrls" @click="imageClick(index)" :key="index" class="img-item" mode="aspectFill" :src="img"></image>
	</view>
</template>

<script>
	import {formatImgPath} from '@/common/filter.js'
	export default {
		name:"image-list",
		props: {
			pics: String
		},
		data() {
			return {
				picSmallUrls: [],
				picUrls: [],
			};
		},
		created(){
			let picList = this.pics.split(';')
			for (let image of picList) {
				if(image){
					this.picSmallUrls.push(formatImgPath(image, '120', '120'))
					this.picUrls.push(formatImgPath(image))
				}
				console.log('this.picUrls',this.picUrls);
			}
			// console.log('picUrls',this.picUrls)
		},
		methods:{
			imageClick(index) {
				uni.previewImage({
					current: index,
					urls: this.picUrls
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
.info-imgs{
	display: flex;
	flex-wrap: wrap;
	.img-item{
		width: 90rpx;
		height: 90rpx;
		margin: 2rpx 2rpx 0 0;
	}
}
</style>
